<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>Test -- Buffer from string</title>
</head>
<body>
  <p>We are using node.js
    <script>
      document.write(process.version)
    </script>.
  </p>
  <p>Message:
    <input type="text" id="message"/>
  </p>
  <p>
    <input type="button" id="send-message-btn" value="send!" />
  </p>
  <script type="text/javascript">
    var results = [];
    document.getElementById('send-message-btn').addEventListener('click', function() {
      var the_message = document.getElementById('message').value;
      console.log('original message: ' + the_message);
      var message_buffer = new Buffer(the_message, 'utf8');
      var message_buffer_string = message_buffer.toString();
      if (message_buffer_string != the_message){
        results.push(false);
      } else {
        results.push(true);
      }
    });
  </script>

</body>

</html>
